package de.teamgamma.cansat.groundstation.server;

import java.io.IOException;

public class Hostednetwork {

	public static final String SSID = "Apollo_12";
	public static final String KEY = "robijrobij";
	private Runtime runtime;
	
	public Hostednetwork() {
		runtime = Runtime.getRuntime();
	}
	
	
	private void configureNetwork() {
		try {
			runtime.exec("netsh wlan set hostednetwork ssid=" + SSID + " key=" + KEY);
		} catch (IOException e) {
			System.err.println("Problem while configure hostednetwork");
			e.printStackTrace();
		}
	}
	
	public void startNetwork() {
		configureNetwork();
		try {
			runtime.exec("netsh wlan start hostednetwork");
		} catch(IOException e) {
			System.err.println("Problem while starting the hosted network");
			e.printStackTrace();
		}
	}
	
	public void stopNetwork() {
		try {
			runtime.exec("netsh wlan stop hostednetwork");
		} catch (IOException e) {
			System.err.println("Problem while stopping the network");
			e.printStackTrace();
		}
	}
}
